// Verilated -*- C++ -*-
// DESCRIPTION: Verilator output: Design implementation internals
// See Vysyx_22040213_sext12to64.h for the primary calling header

#include "Vysyx_22040213_sext12to64___024root.h"
#include "Vysyx_22040213_sext12to64__Syms.h"

#include "verilated_dpi.h"

//==========

extern "C" void breakpoint(int ebreak);

VL_INLINE_OPT void Vysyx_22040213_sext12to64___024root____Vdpiimwrap_ysyx_22040213_top__DOT__alu1__DOT__breakpoint_TOP(IData/*31:0*/ ebreak) {
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vysyx_22040213_sext12to64___024root____Vdpiimwrap_ysyx_22040213_top__DOT__alu1__DOT__breakpoint_TOP\n"); );
    // Body
    int ebreak__Vcvt;
    for (size_t ebreak__Vidx = 0; ebreak__Vidx < 1; ++ebreak__Vidx) ebreak__Vcvt = ebreak;
    breakpoint(ebreak__Vcvt);
}

VL_INLINE_OPT void Vysyx_22040213_sext12to64___024root___combo__TOP__1(Vysyx_22040213_sext12to64___024root* vlSelf) {
    if (false && vlSelf) {}  // Prevent unused
    Vysyx_22040213_sext12to64__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp;
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vysyx_22040213_sext12to64___024root___combo__TOP__1\n"); );
    // Body
    vlSelf->ysyx_22040213_top__DOT__ext_imm = (((- (QData)((IData)(
                                                                   (vlSelf->inst 
                                                                    >> 0x1fU)))) 
                                                << 0xcU) 
                                               | (QData)((IData)(
                                                                 (vlSelf->inst 
                                                                  >> 0x14U))));
}

VL_INLINE_OPT void Vysyx_22040213_sext12to64___024root___sequent__TOP__3(Vysyx_22040213_sext12to64___024root* vlSelf) {
    if (false && vlSelf) {}  // Prevent unused
    Vysyx_22040213_sext12to64__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp;
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vysyx_22040213_sext12to64___024root___sequent__TOP__3\n"); );
    // Variables
    CData/*4:0*/ __Vdlyvdim0__ysyx_22040213_top__DOT__reg1__DOT__rf__v0;
    CData/*0:0*/ __Vdlyvset__ysyx_22040213_top__DOT__reg1__DOT__rf__v0;
    QData/*63:0*/ __Vdlyvval__ysyx_22040213_top__DOT__reg1__DOT__rf__v0;
    // Body
    __Vdlyvset__ysyx_22040213_top__DOT__reg1__DOT__rf__v0 = 0U;
    vlSelf->pc = ((IData)(vlSelf->rst) ? 0x80000000ULL
                   : (4ULL + vlSelf->pc));
    if ((0x13U == (0x7fU & vlSelf->inst))) {
        __Vdlyvval__ysyx_22040213_top__DOT__reg1__DOT__rf__v0 
            = vlSelf->ysyx_22040213_top__DOT__wdata;
        __Vdlyvset__ysyx_22040213_top__DOT__reg1__DOT__rf__v0 = 1U;
        __Vdlyvdim0__ysyx_22040213_top__DOT__reg1__DOT__rf__v0 
            = vlSelf->ysyx_22040213_top__DOT__waddr;
    }
    if (__Vdlyvset__ysyx_22040213_top__DOT__reg1__DOT__rf__v0) {
        vlSelf->ysyx_22040213_top__DOT__reg1__DOT__rf[__Vdlyvdim0__ysyx_22040213_top__DOT__reg1__DOT__rf__v0] 
            = __Vdlyvval__ysyx_22040213_top__DOT__reg1__DOT__rf__v0;
    }
}

VL_INLINE_OPT void Vysyx_22040213_sext12to64___024root___combo__TOP__4(Vysyx_22040213_sext12to64___024root* vlSelf) {
    if (false && vlSelf) {}  // Prevent unused
    Vysyx_22040213_sext12to64__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp;
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vysyx_22040213_sext12to64___024root___combo__TOP__4\n"); );
    // Body
    if ((0x13U == (0x7fU & vlSelf->inst))) {
        if ((0U == (7U & (vlSelf->inst >> 0xcU)))) {
            vlSelf->ysyx_22040213_top__DOT__wdata = 
                (((0U != (0x1fU & (vlSelf->inst >> 0xfU)))
                   ? vlSelf->ysyx_22040213_top__DOT__reg1__DOT__rf
                  [(0x1fU & (vlSelf->inst >> 0xfU))]
                   : 0ULL) + vlSelf->ysyx_22040213_top__DOT__ext_imm);
            vlSelf->ysyx_22040213_top__DOT__waddr = 
                (0x1fU & (vlSelf->inst >> 7U));
        } else {
            vlSelf->ysyx_22040213_top__DOT__wdata = 
                ((0U != (0x1fU & (vlSelf->inst >> 0x14U)))
                  ? vlSelf->ysyx_22040213_top__DOT__reg1__DOT__rf
                 [(0x1fU & (vlSelf->inst >> 0x14U))]
                  : 0ULL);
        }
    } else if ((0x73U == (0x7fU & vlSelf->inst))) {
        if ((1ULL == vlSelf->ysyx_22040213_top__DOT__ext_imm)) {
            Vysyx_22040213_sext12to64___024root____Vdpiimwrap_ysyx_22040213_top__DOT__alu1__DOT__breakpoint_TOP(1U);
        }
    } else {
        vlSelf->ysyx_22040213_top__DOT__waddr = 0U;
    }
}

void Vysyx_22040213_sext12to64___024root___eval(Vysyx_22040213_sext12to64___024root* vlSelf) {
    if (false && vlSelf) {}  // Prevent unused
    Vysyx_22040213_sext12to64__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp;
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vysyx_22040213_sext12to64___024root___eval\n"); );
    // Body
    Vysyx_22040213_sext12to64___024root___combo__TOP__1(vlSelf);
    vlSelf->__Vm_traceActivity[1U] = 1U;
    if (((IData)(vlSelf->clk) & (~ (IData)(vlSelf->__Vclklast__TOP__clk)))) {
        Vysyx_22040213_sext12to64___024root___sequent__TOP__3(vlSelf);
        vlSelf->__Vm_traceActivity[2U] = 1U;
    }
    Vysyx_22040213_sext12to64___024root___combo__TOP__4(vlSelf);
    // Final
    vlSelf->__Vclklast__TOP__clk = vlSelf->clk;
}

QData Vysyx_22040213_sext12to64___024root___change_request_1(Vysyx_22040213_sext12to64___024root* vlSelf);

VL_INLINE_OPT QData Vysyx_22040213_sext12to64___024root___change_request(Vysyx_22040213_sext12to64___024root* vlSelf) {
    if (false && vlSelf) {}  // Prevent unused
    Vysyx_22040213_sext12to64__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp;
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vysyx_22040213_sext12to64___024root___change_request\n"); );
    // Body
    return (Vysyx_22040213_sext12to64___024root___change_request_1(vlSelf));
}

VL_INLINE_OPT QData Vysyx_22040213_sext12to64___024root___change_request_1(Vysyx_22040213_sext12to64___024root* vlSelf) {
    if (false && vlSelf) {}  // Prevent unused
    Vysyx_22040213_sext12to64__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp;
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vysyx_22040213_sext12to64___024root___change_request_1\n"); );
    // Body
    // Change detection
    QData __req = false;  // Logically a bool
    return __req;
}

#ifdef VL_DEBUG
void Vysyx_22040213_sext12to64___024root___eval_debug_assertions(Vysyx_22040213_sext12to64___024root* vlSelf) {
    if (false && vlSelf) {}  // Prevent unused
    Vysyx_22040213_sext12to64__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp;
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vysyx_22040213_sext12to64___024root___eval_debug_assertions\n"); );
    // Body
    if (VL_UNLIKELY((vlSelf->clk & 0xfeU))) {
        Verilated::overWidthError("clk");}
    if (VL_UNLIKELY((vlSelf->rst & 0xfeU))) {
        Verilated::overWidthError("rst");}
}
#endif  // VL_DEBUG
